home *** CD-ROM | disk | FTP | other *** search
- ` ------------------------------------------------------------------------
- ` Pre-Calculated Scroller DarkForge Snippet (6/8/2000)
- ` ------------------------------------------------------------------------
- `
- ` In the days of old we had to pre-calculate everything. In this example
- ` I show you how to achieve a smooth and fast full-screen scroller using
- ` only sprites that never change position.
-
- sync rate 0
- sync on
- hide mouse
-
- load image "bubble.bmp",1
-
- ` Change this value from 2 to 32!
- speed=8
-
- ` Pre-calculate the sprites
-
- offset#=-128
-
- for i=1 to 129
- paste image 1,offset#+i,0
- paste image 1,offset#+64+i,0
- paste image 1,offset#+128+i,0
- get image i+1,0,0,64,64
- sprite i,-256,0,i
- set sprite i,0,1
- next i
-
- spr=2 : i=1
-
- do
-
- cls 0
-
- for y=0 to 480 step 64
-
- for x=0 to 640 step 64
- sprite i,x,y,spr
- inc i
- next x
-
- next y
-
- spr=spr+speed
- if spr>129 then spr=2
- i=1 : inc d,2
-
- sync
-
- loop
-
-